<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ace="http://www.icefaces.org/icefaces/components"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
  <h:head>
    <title>Facelet Title</title>
    <link rel="stylesheet" type="text/css" href="css/style.css" />
  </h:head>
  <h:body>
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:c="http://java.sun.com/jsp/jstl/core"
                    xmlns:ace="http://www.icefaces.org/icefaces/components"
                    xmlns:icecore="http://www.icefaces.org/icefaces/core"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    template="layout.xhtml">
      <ui:define name="title">Update profile / Awesome Dates</ui:define>
      <ui:define name="content">

        <ace:panel id="accountControlPanel" header="Account control" style="margin-bottom: 30px;">  
          <h:form>
            <h:panelGrid columns="2" style="line-height: 3em;margin:0 auto" width="50%" styleClass="textEntryInputTable">
              <h:outputLabel value="Upgrade account"/>
              <h:commandButton value="Upgrade" action="payPal.xhtml"/>
              <h:outputLabel value="Deactivate account"/>
              <h:commandButton value="Deactivate" action="#{userManager.deleteUser()}"/>
            </h:panelGrid>
          </h:form>
        </ace:panel>

        <ace:panel id="UpdatePersonalInfoPanel" header="Update Personal Info" style="line-height: 3em;">
          <h:form >
            <h:panelGrid columns="2" width="80%" styleClass="textEntryInputTable" style="margin:0 auto;">

              <f:event listener="#{userManager.validatePassword}" type="postValidate" />

              <h:outputLabel value="New password : "/>
              <ace:textEntry secret="true" id="newPasswordUpdateInput" value="#{userManager.user.password}">
                <f:validator validatorId="ValidatePassword" />
              </ace:textEntry>

              <h:outputLabel value="New password again : "/>
              <ace:textEntry secret="true" id="newPasswordAgainUpdateInput" value="#{userManager.user.password}">
              </ace:textEntry>

              <h:outputLabel value="City : "/>
              <ace:textEntry id="cityUpdateInput" value="#{userManager.user.city}">
                <f:validator validatorId="ValidateCity" />
              </ace:textEntry>

              <h:outputLabel value="Birth year : "/>
              <ace:simpleSelectOneMenu value="#{userManager.user.age}">
                <f:selectItems value="#{userManager.chiffreAnnee}"></f:selectItems>
              </ace:simpleSelectOneMenu>                         

              <h:outputLabel value="Height (cm) : "/>
              <ace:maskedEntry id="heightUpdateInput" value="#{userManager.user.height}" mask="999">
              </ace:maskedEntry>

              <h:outputLabel value="Goal : "/>
              <ace:textEntry id="goalUpdateInput" value="#{userManager.user.goal}">
                <f:validator validatorId="ValidateGoal" />
              </ace:textEntry>

              <h:outputLabel value="Resume : "/>
              <ace:textAreaEntry id="resumeUpdateInput" value="#{userManager.user.resume}"> 
                <f:validator validatorId="ValidateResume" />
              </ace:textAreaEntry>

              <h:outputLabel value="Appearance : "/>
              <ace:textAreaEntry id="apparenceUpdateInput" value="#{userManager.user.apparence}">
                <f:validator validatorId="ValidateApparence" />
              </ace:textAreaEntry>

              <h:outputLabel value="Sex : "/>
              <h:selectOneRadio id="sexUpdateInput" value="#{userManager.user.sex}">
                <f:selectItem id="item1" itemLabel="Male" itemValue="Male" />
                <f:selectItem id="item2" itemLabel="Female" itemValue="Female" />
              </h:selectOneRadio>

              <h:outputLabel value="Looking for sex : "/>
              <h:selectOneRadio value="#{userManager.user.lookingForSex}">
                <f:selectItem id="item3" itemLabel="Male" itemValue="Male" />
                <f:selectItem id="item4" itemLabel="Female" itemValue="Female" />
              </h:selectOneRadio>

              <h:outputLabel value="Warned new email : "/>
              <h:selectOneRadio value="#{userManager.user.isWarnedByEmail}">
                <f:selectItem itemLabel="Yes" itemValue="True" />
                <f:selectItem itemLabel="No" itemValue="False" />
              </h:selectOneRadio>

              <h:outputLabel value="Warned add favorite : "/>
              <h:selectOneRadio id="lookingForSexUpdateInput" value="#{userManager.user.isWarnedAddWatchList}">
                <f:selectItem itemLabel="Yes" itemValue="True" />
                <f:selectItem itemLabel="No" itemValue="False" />
              </h:selectOneRadio>

              <h:outputLabel value="Interests : "/>
              <h:selectManyCheckbox value="#{userManager.interetChoisi}" layout="pageDirection">
                <f:selectItem itemValue="1" itemLabel="Musique" />
                <f:selectItem itemValue="2" itemLabel="Sport" />
                <f:selectItem itemValue="3" itemLabel="Voyage" />
                <f:selectItem itemValue="4" itemLabel="Lecture" />
                <f:selectItem itemValue="5" itemLabel="Plein air" />
                <f:selectItem itemValue="6" itemLabel="Cuisine" />
                <f:selectItem itemValue="7" itemLabel="Cinema" />
                <f:selectItem itemValue="8" itemLabel="Arts" />
              </h:selectManyCheckbox>  
            </h:panelGrid> 
            <h:commandButton value="Update" action="#{userManager.updateAUser()}"/>
          </h:form>
        </ace:panel>

        <ace:messages/>

      </ui:define>
    </ui:composition>
  </h:body>
</html>

